package com.example.a2209_shop.adapter

import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.a2209_shop.R
import com.example.base.entity.CommentEntity
import java.text.SimpleDateFormat

class CommentAdapter:BaseMultiItemQuickAdapter<CommentEntity,BaseViewHolder>() {
    init {
        addItemType(0, R.layout.item_comment_one)
        addItemType(1, R.layout.item_comment_more)
        addItemType(2, R.layout.item_comment_two)
    }
    override fun convert(holder: BaseViewHolder, item: CommentEntity) {
        when(holder.itemViewType){
            0,2->{
                Glide.with(context).load(item.icon).into(holder.getView(R.id.comment_icon))
                holder.setText(R.id.comment_username,item.username)
                holder.setText(R.id.comment_msg,item.msg)
                holder.setText(R.id.comment_time,item.createtime)
            }
        }
    }
}